//
//  XieJiLuViewController.m
//  JuBoCRM
//
//  Created by iMac on 2024/2/3.
//  Copyright © 2024 iningKe. All rights reserved.
//

#import "XieJiLuViewController.h"
#import "WaiQinQianDaoViewController.h"
#import "GenJinJiLuViewController.h"
@interface XieJiLuViewController ()

@end

@implementation XieJiLuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setupNavBar];


    // 设置自定义导航栏背景图片
    self.customNavBar.barBackgroundImage = [UIImage imageNamed:@"导航栏"];
    

    [self zaiRuView];
    
}

- (void)zaiRuView{
    //标题数组
    NSArray *data = @[@"跟进记录",@"外勤签到"];
    WMZPageParam *param = PageParam()
    .wTitleArrSet(data)
    .wMenuBgColorSet([UIColor whiteColor])
    .wMenuTitleColorSet(rgba(90, 98, 112, 1))
    .wMenuTitleSelectColorSet(rgba(24, 27, 37, 1))
    .wMenuAnimalTitleGradientSet(YES)
    .wMenuTitleWidthSet((ScreenWidth-0)/3)
    .wMenuHeightSet(44)
    .wMenuIndicatorColorSet(rgba(40, 120, 255, 1))
    .wMenuIndicatorWidthSet(48)
    .wMenuIndicatorHeightSet(3)
    .wMenuIndicatorRadioSet(1.5)
    .wMenuPositionSet(PageMenuPositionCenter)
    .wMenuTitleUIFontSet([UIFont systemFontOfSize:16])
    .wMenuTitleSelectUIFontSet([UIFont systemFontOfSize:16 weight:UIFontWeightMedium])
    //控制器数组
    .wViewControllerSet(^UIViewController *(NSInteger index) {
       
        if(index == 0){
            GenJinJiLuViewController*vc = GenJinJiLuViewController.new;
            return vc;
        }
        
        WaiQinQianDaoViewController*vc = WaiQinQianDaoViewController.new;
        return vc;
    })
    .wCustomTabbarYSet(^CGFloat(CGFloat nowY) {
        return nowY;
    })
    .wBouncesSet(YES)
    //控制器结束切换
    .wEventEndTransferControllerSet(^(UIViewController *oldVC, UIViewController *newVC, NSInteger oldIndex, NSInteger newIndex) {
       NSLog(@"结束切换 %ld %ld",oldIndex,newIndex);
        _currentIndex = newIndex;
     })
    //悬浮开启
    .wTopSuspensionSet(NO)
    //顶部可下拉
    .wBouncesSet(NO)
    //头视图y坐标从导航栏开始
    .wFromNaviSet(NO)
    //导航栏透明度变化
    .wNaviAlphaSet(YES)
    .wMenuAnimalSet(PageTitleMenuAiQY)
    .wMenuDefaultIndexSet(_currentIndex)
    .wMenuHeadViewSet(^UIView *{
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, NavaBarHeight)];
        return backView;
    });
    //头部
    param.wCustomDataViewHeight = ^CGFloat(CGFloat nowY) {
        /// 再减掉父类的菜单高度
        return nowY-NavaBarHeight;
    };

    self.param = param;
}




- (void)setupNavBar{
    
    [self.view addSubview:self.customNavBar];
    [self.customNavBar wr_setBottomLineHidden:YES];
    if (self.navigationController.childViewControllers.count != 1) {
        [self.customNavBar wr_setLeftButtonWithImage:[UIImage imageNamed:@"返回"]];
    }
}



- (WRCustomNavigationBar *)customNavBar{
    if (_customNavBar == nil) {
        _customNavBar = [WRCustomNavigationBar CustomNavigationBar];
        _customNavBar.tintColor = [UIColor whiteColor];
        _customNavBar.titleLabelColor = rgba(24, 27, 37, 1);
        _customNavBar.barBackgroundImage = LocalImagePath(@"导航栏");
        _customNavBar.titleLabelFont = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
        _customNavBar.title = @"写记录";
    }
    return _customNavBar;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
